package com.panda.rentHouse.dao;

import java.util.List;
import java.util.Map;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import com.panda.common.dao.BaseRepository;
import com.panda.rentHouse.pojo.Menu;

public interface MenuDao extends BaseRepository<Menu, Integer>{
	
	@Query(nativeQuery = true, value = " select * from menu \n"
			+ " where level = 1 and status = 1  \n"
			+ " order by seq ")
	List<Menu> getParentMenuList() throws Exception;
	
	/**
	 * 菜单列表
	 * @return
	 * @throws Exception
	 */
	@Query(nativeQuery = true, value = "select level, menuName name, menuCode code, url from menu \n"
			+ " where level = 2 and status = 1  and parentCode = :parentCode \n"
			+ " order by seq ")
	List<Map<String,Object>> getChildMenuList(@Param("parentCode") String parentCode) throws Exception;

}
